
****************************************************************

Note: This file has been provided as supplimentary information.
You do not need to know or understand ANY part of this document
to use GameScript to it's fullest capabilities.

****************************************************************





GameScript Assembly Language Style Reference
________________________________________________________________
For clarity, some sybols are used to indicate identifier classification:

TypeDef names are enclosed in {} braces. Ex: "new  [car], {Vehicle}"
Variable names are enclosed in [] braces. Ex: "mov  [pi], 3.14159"
Type field names are enclosed in <> braces. Ex: "xfc  <speed>, 120"


GameScript Opcode Reference
________________________________________________________________
The GameScript Opcodes are highly specific to a virtual machine (so they can run as fast as possible), and definitely could not run on a CPU without major compiler changes.

mov  a, b
  Moves the contents of "b" into "a"

mfc  a, b
  Moves the contents of the ecx."b" (type ecx, field "b") into "a"

mfa  a, b
  Moves the contents of the eax."b" (type eax, field "b") into "a" (same as mfc except uses eax instead of ecx)

xfc  a, b
  Moves the contents of "b" into ecx."a" (type ecx, field "a")

xfa  a, b
  Moves the contents of "b" into eax."a" (type eax, field "a") (same as xfc except uses eax instead of ecx)

new  a, b
  Copy the reference of a new instance of custom type name "b" into "a". Example:
  ASM "new  [car], {Vehicle}" = BASIC "car = New Vehicle"

del  a
  Deletes custom type object a

jz   a
  Jumps the program execution point over to label "a" IF eax is = 0

jmp  a
  Jumps the program execution point over to label "a"

end
  Ends the program completely

push a
  Puts "a" at the top of the stack

pop  a
  Retreives the top item from the stack and puts it in "a"

vpop a
  Retreives the top item from the stack and copies it to "a". This leaves the stack totally undisturbed.

xpop
  Discards the top item of the stack.

and  a, b
  Applies the logical operator AND on "a" and "b", storing the result in eax.

or   a, b
  Applies the logical operator OR on "a" and "b", storing the result in eax.

xor  a, b
  Applies the logical operator XOR on "a" and "b", storing the result in eax.

not  a
  Applies the logical operator NOT to "a".

neg  a
  a = -a

cLT  a, b
  If a < b Then eax = 1 Else eax = 0

cGT  a, b
  If a > b Then eax = 1 Else eax = 0

cLE  a, b
  If a <= b Then eax = 1 Else eax = 0

cGE  a, b
  If a >= b Then eax = 1 Else eax = 0

cEQ  a, b
  If a = b Then eax = 1 Else eax = 0

cNE  a, b
  If a <> b Then eax = 1 Else eax = 0

add  a, b
  Adds "a" and "b" and puts the sum in eax

sub  a, b
  Subtracts "b" from "a" and puts the result in eax

mul  a, b
  Multiplies "a" by "b" and puts the product in eax

div  a, b
  Divides "a" by "b" and puts the result in eax

shl  a, b
  Performs a left binary shift on "a", repeating "b" number of times

shr  a, b
  Performs a right binary shift on "a", repeating "b" number of times

cpush a
  This "pushes" the current execution point on the top of the call stack, plus "a". In other words, the next time "cpop" is executed, it will "jmp" to "a" instrucions past this "cpush" line. "a" should NEVER be 0, because that would lock up when the program "cpops" (returns) to the same line, causing an endless loop.

cpop
  This "pops" the execution point from the top of the call stack, which causes a "jmp" to that point.
